package com.study.controller;

import com.study.service.TransactionalService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@RestController
@RequestMapping("/transactional")
public class TransactionalController {

    private final TransactionalService transactionalService;

    public TransactionalController(TransactionalService transactionalService){
        this.transactionalService = transactionalService;
    }

    @GetMapping("/wrongTest001")
    public void wrong001() throws Exception {
        log.info("wrongTest001");
        transactionalService.wrongTest001();
    }

    @GetMapping("/wrongTest002")
    public void wrongTest002() throws Exception {
        log.info("wrongTest002");
        transactionalService.wrongTest002();
    }

    @GetMapping("/wrongTest003")
    public void wrongTest003() throws Exception {
        log.info("wrongTest003");
        transactionalService.wrongTest003();
    }

    @GetMapping("/wrongTest004")
    public void wrongTest004() throws Exception {
        log.info("wrongTest004");
        transactionalService.wrongTest004();
    }

    @GetMapping("/wrongTest005")
    public void wrongTest005() throws Exception {
        log.info("wrongTest005");
        transactionalService.wrongTest005();
    }

    @GetMapping("/rightTest002")
    public void rightTest002() throws Exception {
        log.info("rightTest002");
        transactionalService.rightTest002();
    }

    @GetMapping("/rightTest003")
    public void rightTest003() throws Exception {
        log.info("rightTest003");
        transactionalService.rightTest003();
    }

    @GetMapping("/rightTest001")
    public void rightTest001() throws Exception {
        log.info("rightTest001");
        transactionalService.rightTest001();
    }

}
